<script>
  import config from './config'
  import store from '@/store'
  import { getToken } from '@/utils/auth'

  export default {
    onLaunch: function() {
      this.initApp()
    },
	globalData:{
		shopList: [
		  {
		    id: 1,
		    name: '小王汽车美容店',
		    rating: 4.3,
		    sales: 322,
		    distance: '44m',
		    hours: '周一至周五 09:00-22:00',
		    address: '山阳区人民中路32号',
		    avatar: '/static/shops/shop1.jpg',
				  service:"服务介绍服务介绍服务介绍服务介绍",
				  phone:123456
		  },
		  {
		    id: 2,
		    name: '闪电快洗中心',
		    rating: 4.8,
		    sales: 689,
		    distance: '850m',
		    hours: '每天 09:00-20:00',
		    address: '生态新城环保路102号',
		    avatar: '/static/shops/shop2.jpg',
				  service:"服务介绍服务介绍服务介绍服务介绍",
				  phone:123456
		  },
		  {
		    id: 3,
		    name: '全自动洗车工厂',
		    rating: 4.5,
		    sales: 512,
		    distance: '1.2km',
		    hours: '周一至周日 07:30-21:30',
		    address: '高新技术开发区创新路88号',
		    avatar: '/static/shops/shop3.jpg',
				  service:"服务介绍服务介绍服务介绍服务介绍",
				  phone:123456
		  }
		],
			
		userInfo:{
			userId:1,
			userName:'张三',
			carId:null,
			CouponsId:null
		},
		carList:[
		{ 
			carId:1,
			carPhoto:'',
			type:'奔驰',
			licensePlate:'豫M34523'
		},
		{
			carId:2,
			carPhoto:'',
			type:'坦克',
			licensePlate:'豫M34523'
		}
		],
		geo:{
			longitude:0,
			latitude:0
		}
	},
	
    methods: {
      // 初始化应用
      initApp() {
        // 初始化应用配置
        this.initConfig()
        // 检查用户登录状态
        //#ifdef H5
        this.checkLogin()
        //#endif
      },
      initConfig() {
        this.globalData.config = config
      },
      checkLogin() {
        if (!getToken()) {
          this.$tab.reLaunch('/pages/login') 
        }
      }
    }
  }
</script>

<style lang="scss">
  @import '@/static/scss/index.scss'
</style>
